let guid=()=>'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c=> {
    let r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
    return v.toString(16);
});


let IP = '192.168.0.104';//IP地址
let PREFIX = 'http://' + IP +':31021/api/custom/';//接口前缀
let IMAGE = 'http://' + IP +':31021/api/custom/img_path?path=';//图片前缀
let VIDEO = IP+':31021/stream/012353-50C908-3088EE';//视频流地址
let SOCKET = 'ws://'+IP+':31021/face/result/'+guid();//推送地址

let DATA = {
  Title: '',
  //结束时间0000-00-00 00:00:00
  endTime: '',
  //会议日期0000-00-00
  StartDate: '',
  //主持人
  Host: '',
  //时间段
  Times: '',
  //地址
  Addr: '',
  //时长
  Duration: '',
  //描述
  Desc: '',
  //温度
  Temperature: '',
  //湿度
  Humidity: '',
  //已签到
  Checked: ['http://iph.href.lu/50x50', 'http://iph.href.lu/50x50'],
  //未签到
  UnCheck: ['http://iph.href.lu/50x50', 'http://iph.href.lu/50x50'],
  //空气质量
  AirQuality: ''
};

//jq跨域
jQuery.support.cors = true;
//请求
let ajax = (url, data, call, type) => {
  let getajax = $.ajax({
    url: PREFIX + url,
    timeout: 30000,
    //headers:{'Authorization':'Bearer '+localStorage.token},
    type: type || 'get',
    data: data,
    dataType: 'json',
    complete (v, status) {
      if (status == 'timeout') getajax.abort();
      call(v.responseText ? JSON.parse(v.responseText) : v);
    }
  })
};

let get_href = name => {
  let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  let r = window.location.search.substr(1).match(reg);
  return r && r[2]
};

$(() => { resize() });

//窗口大小变化
let resize = () => {
  $('#page').height(innerWidth * 9 / 16);
};
window.onresize = () => { resize() };

//禁用右键
document.oncontextmenu = function () {
  event.returnValue = false;
};
